home *** CD-ROM | disk | FTP | other *** search
/ Delphi Developer's Kit 1996 / Delphi Developer's Kit 1996.iso / power / cshape / cshape.pas next >
Pascal/Delphi Source File  |  1995-12-22  |  1KB  |  55 lines

  1. unit CShape;
  2.  
  3. {  TCShape component is a descendant of tShape.  New property,
  4.    ChangeColor, is used to change the default fill color of white.
  5.    Values for the property ChangeColor are chosen from tColor.
  6.                  Frank DeBlanc@70713,640        }
  7.  
  8. interface
  9.  
  10. uses
  11.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  12.   Forms, Dialogs, ExtCtrls;
  13.  
  14. type
  15.   TCShape = class(TShape)
  16.   private
  17.     { Private declarations }
  18.   protected
  19.   FColorOfShape: TColor;
  20.     { Protected declarations }
  21.   procedure SetColorOfShape(Value: TColor);
  22.   public
  23.     { Public declarations }
  24.   Constructor Create(AOwner: TComponent); override;
  25.   published
  26.     { Published declarations }
  27.   Property ChangeColor: TColor read FColorOfShape write SetColorOfShape;
  28.   end;
  29.  
  30. procedure Register;
  31.  
  32. implementation
  33.  
  34. Constructor TCShape.Create(AOwner: TComponent);
  35. begin
  36. inherited Create(AOwner);
  37. FColorOfShape := clWhite;
  38. end;
  39.  
  40. procedure TCShape.SetColorOfShape(Value: TColor);
  41. begin
  42.   if FColorOfShape <> Value then
  43.      begin
  44.       FColorOfShape := Value;
  45.       Self.Brush.Color := FColorOfShape;
  46.      end;
  47. end;
  48.  
  49. procedure Register;
  50. begin
  51.   RegisterComponents('Samples', [TCShape]);
  52. end;
  53.  
  54. end.
  55.